var a = getApp();

Page({
    data: {
        language: "",
        mailLanguage: "",
        mailTeamReturnTitle: "",
        mailTeamAmount: "",
        mailTeamReturnRate: "",
        mailTeamName: "",
        mailTeamReturnName: "",
        order_amount: 0,
        return_amount: 0,
        status_name: "",
        each_return_rate: 0,
        return_mode: "",
        not_return: 0,
        id: "",
        order_sn: "",
        created_at: "",
        finish_time: "",
        mall_amount: "",
        rate: "",
        power_data: "",
        power_total: ""
    },
    onLoad: function(a) {
        this.initMailLanguage(), this.getData();
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    initMailLanguage: function() {
        var t, e = this, n = a.getNetAddresss("setting.get-lang-setting");
        a._getNetWork({
            url: n,
            success: function(n) {
                var r = n.data;
                if (1 === r.result) {
                    t = r.data;
                    var i = a.setMailLanguage("赠送详情", t.team_return.return_detail), o = a.setMailLanguage("赠送金额", t.team_return.return_amount), u = a.setMailLanguage("赠送比例", t.team_return.return_rate), l = a.setMailLanguage("经销商", t.team_return.mailTeamName), m = a.setMailLanguage("赠送", t.team_return.return_name);
                    e.setData({
                        mailTeamReturnTitle: i,
                        mailTeamAmount: o,
                        mailTeamReturnRate: u,
                        mailTeamReturnName: m,
                        mailTeamName: l
                    }), wx.setNavigationBarTitle({
                        title: i || ""
                    });
                } else wx.showToast({
                    title: r.msg,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.team-return.api.team-return.get-team-return-detail");
        e += "&logid=" + this.options.id, a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                1 === e.result ? t.setData({
                    return_amount: e.data.amount,
                    power_total: e.data.power_total,
                    power_data: e.data.power_data,
                    mall_amount: e.data.mall_amount,
                    id: e.data.id,
                    rate: e.data.rate,
                    created_at: e.data.created_at
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});